<?php
// 后台路由
// 路由分组
Route::group(['prefix'=>'admin','namespace'=>'Admin'],function () {
    Route::get('/403',function(){
        abort(403,'抱歉你没有权限访问！');
    })->name('admin.403');
    Route::get('login','LoginController@index')->name('admin.login');
    Route::post('login','LoginController@login')->name('admin.login');

    Route::group(['middleware'=>['ckadmin'],'as'=>'admin.'],function(){
        Route::get('index','IndexController@index')->name('index');
        Route::get('welcome','IndexController@welcome')->name('welcome');
        Route::get('logout','IndexController@logout')->name('logout');

        //用户管理
        // Route::get('admin-users/index','AdminUsersController@index')->name('users.index');
        // 删除用户 这里可以用get 用delete的话，前台要用ajax指定提交方式为delete否则报错
        // Route::delete('admin-users/del/{id}','AdminUsersController@del')->name('admin-users.del');
        // 还原用户
        Route::get('admin-users/restore/{id}','AdminUsersController@restore')->name('admin-users.restore');
        // 全选删除
        Route::delete('admin-users/delall','AdminUsersController@delall')->name('admin-users.delall');
        // 禁用/启用用户
        Route::post('admin-users/start','AdminUsersController@start')->name('admin-users.start');
        Route::post('admin-users/stop','AdminUsersController@stop')->name('admin-users.stop');
        // 给用户分配角色
        Route::match(['get','post'],'admin-users/role/{admin}','AdminUsersController@role')->name('admin-users.role');
        Route::resource('admin-users','AdminUsersController');

        //角色
        Route::get('role/auth/{role}','RoleController@auth')->name('role.auth');
        Route::post('role/auth/{role}','RoleController@authSave')->name('role.auth');
        Route::resource('role', 'RoleController');
        //权限
        Route::resource('auth', 'AuthController');
    });


});